package com.lphj.datainterface.handle;

import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 订单ID生成
 */
public class OrderIdHandle {
    public static String getOrderId(String number,Date date) {
        String orderId = "D019";
        SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyyMMdd");
        orderId = orderId + sDateFormat.format(date);
        //不足4位自动补0
        for(int i=0;i<4;i++) {
            if(number.length()<4) {
                number = "0" + number;
            }
        }
        return orderId + number;
    }

    public static void main(String[] args) {
        //new OrderIdHandle().getOrderId("123");
    }
}
